<%@ page contentType="text/html; charset=UTF-8" language="java"%>
<%@ page import="com.hzqy.commons.utils.ConstantUtils" %>
<%@ taglib prefix="limits" uri="/WEB-INF/tld/limits.tld"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>客户账号添加页</title>
<link rel="stylesheet" type="text/css"	href="../../static/js/themes/defalut.css">
<link rel="stylesheet" type="text/css"	href="../../static/js/themes/public.css">
<link rel="stylesheet" type="text/css"	href="../../static/js/themes/ddspstyle.css">
<link rel="stylesheet" type="text/css"	href="../../static/js/themes/default/easyui.css">
<link rel="stylesheet" type="text/css"	href="../../static/js/themes/icon.css">
<link rel="stylesheet" type="text/css"	href="../../static/js/WdatePicker/skin/WdatePicker.css">
<script type="text/javascript" src="../../static/js/jquery.min.js"></script>
<script type="text/javascript" src="../../static/js/jquery.easyui.min.js"></script>
<script type="text/javascript"	src="../../static/js/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="../../static/js/jquery.validate.js"></script>
<script type="text/javascript" src="../../static/js/index.js"></script>
<script type="text/javascript" src="../../static/js/WdatePicker/WdatePicker.js"></script>
<script type="text/javascript" charset="utf-8" src="../../ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="../../ueditor/ueditor.all.min.js"></script>
<script type="text/javascript" charset="utf-8" src="../../ueditor/lang/zh-cn/zh-cn.js"></script>
	<script type="text/javascript" charset="utf-8" src="../../static/js/Base64.js"></script>
	<script type="text/javascript" charset="utf-8" src="../../static/js/beforeData.js"></script>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<%
	String para =request.getParameter("f_cc_id");
	int f_cc_id = 0;
	if(para != null)
		f_cc_id = Integer.valueOf(para);
	String []nonceObj=ConstantUtils.getNonceObject();
%>
<script type="text/javascript">
var schedulesIndex = 0;
var f_cc_name_jiami = "";
var f_cc_searchname_jiami = "";
var f_cc_obligate1_jiami = "";
	$(function() {
		var f_cc_id = <%=f_cc_id%>;
		$.ajax({
			url:"../../content/select_content.do?f_cc_id="+f_cc_id,
			success:function(data) {
				data = JSON.parse(data);
				$("#f_cc_id").val(data.f_cc_id);
				f_cc_name_jiami = encryption(data.f_cc_name);
				$("#f_cc_name").val(data.f_cc_name);
				$("#f_cc_name_jiami").val(encryption(data.f_cc_name));
				f_cc_searchname_jiami = encryption(data.f_cc_searchname);
				$("#f_cc_searchname").val(data.f_cc_searchname);
				$("#f_cc_searchname_jiami").val(encryption(data.f_cc_searchname));
				$("#f_cc_companyname").val(data.f_cc_companyname);
				$("#f_cc_companyid").val(data.f_cc_companyid);
				$("#f_cc_isfree").val(data.f_cc_isfree);
				f_cc_obligate1_jiami = encryption(data.f_cc_obligate1);
				$("#f_cc_obligate1").val(data.f_cc_obligate1);
				$("#f_cc_obligate1_jiami").val(encryption(data.f_cc_obligate1));
				$("#f_cc_actors").val(data.f_cc_actors);
				$("#f_cc_desc").val(data.f_cc_desc);
				$("#f_cc_code").val(data.f_cc_code);
				
				try{
					var ue = UE.getEditor('f_cc_desc');
				}catch(e){
					console.info(e);
				}
				data['f_cc_name_jiami']=f_cc_name_jiami;
				data['f_cc_searchname_jiami']=f_cc_searchname_jiami;
				data['f_cc_obligate1_jiami']=f_cc_obligate1_jiami;
				var arrayToJsonBefore={};
				arrayToJsonBefore['picJson']="[]";
				beforeData(data, f_cc_id, arrayToJsonBefore, "../../beforeData.do");
			}
		});
		
		$("#contentForm").validate({
			rules: {
				f_cc_name: {
					required: true,
				},
				f_cc_companyname: {
					required: true
				},
				f_cc_searchname: {
					required: true,
				}
				
			},
			messages: {
				f_cc_name: {
					required: "请输入客户账号"
				},
				f_cc_companyname: {
					required: "请选择客户",
				},
				f_cc_searchname: {
					required: "请输入姓名",
				}
			}
			
		});
		$("select[name='f_cc_isfree']").change(function(){
			if($("#f_cc_isfree option:selected").val()=="1"){
				$("#f_cc_actors").val("review");	
			}else{
				console.log("false");
				$("#f_cc_actors").val("");
			}
			console.log($("#f_cc_isfree option:selected").val());
			console.log($("#f_cc_actors").val());
		})
	});

	function _submitFm() {
		var now_f_cc_name_jiami = $("#f_cc_name_jiami").val();
		if(now_f_cc_name_jiami==f_cc_name_jiami){

		}else{
			if(now_f_cc_name_jiami.indexOf("*")>-1){
				alert("账号不能带有*！");
				return false;
			}else{
				$("#f_cc_name").val(now_f_cc_name_jiami);
			}
		}

		var now_f_cc_searchname_jiami = $("#f_cc_searchname_jiami").val();
		if(now_f_cc_searchname_jiami==f_cc_searchname_jiami){

		}else{
			if(now_f_cc_searchname_jiami.indexOf("*")>-1){
				alert("姓名不能带有*！");
				return false;
			}else{
				$("#f_cc_searchname").val(now_f_cc_searchname_jiami);
			}
		}

		var now_f_cc_obligate1_jiami = $("#f_cc_obligate1_jiami").val();
		if(now_f_cc_obligate1_jiami==f_cc_obligate1_jiami){

		}else{
			if(now_f_cc_obligate1_jiami.indexOf("*")>-1){
				alert("地址不能带有*！");
				return false;
			}else{
				$("#f_cc_obligate1").val(now_f_cc_obligate1_jiami);
			}
		}
		if($("#contentForm").validate().form()) {
		for(var i=0;i<schedulesIndex;i++){
			$("#f_is_frequency"+(i+1)).val($("#day"+(i+1)).val()==0? 0:$("#weekday"+(i+1)).val());
		}
		app_ajax('../../content/update_content.do', $("#contentForm").serialize(), function(data) {
			if (data.success) {
				$.ajax({
					url: "../../cache/clear_web_cache.do",
					type: "GET",
					data: {},
					dataType: "json",
					success: function(data) {}
				});
				
				$.messager.progress('close');
				$.messager.alert('提示', '提交成功！', 'info', function() {
					parent.$('#dlg').dialog('close');
					parent.gotoSearch($('#easyui-treegrid'));
				});
			} else {
				$.messager.alert('提示', data.result, 'info', function() {
					$.messager.progress('close');
				});
			}
		});
	  }
	}
	
	function orgSelect(){
		$("#status").val("change");
		openDialog($('#org_list'),'../behavior_control/org_update.jsp?idField=f_cc_companyid&nameField=f_cc_companyname');
	}
</script>
<style type="text/css">
</style>
</head>

<body class="overfwidth">
	<div class="barnavtop">您所在的位置：客户账号管理 &gt; 客户账号修改</div>
	<div id="workspace">
		<!--主体 开始-->
		<div id="container-1">
			<div class="editspace">
				<form id="contentForm" class="cmxform" enctype="multipart/form-data" name="formName">
					<input id="f_cc_id" name="f_cc_id" type="hidden" value="0" />
					<input id="f_cc_status" name="f_cc_status" type="hidden" value="1" />
					<input id="f_cc_type" name="f_cc_type" type="hidden" value="100" />
					<input id="picJson" name="picJson" type="hidden" value="[]" />
					<input id="f_cc_actors" name="f_cc_actors" type="hidden" value="" />	
					<input id="f_cc_obligate2" name="f_cc_obligate2" type="hidden" value="" />
					<input id="f_cc_name" name="f_cc_name" type="hidden" value="" />
					<input id="f_cc_searchname" name="f_cc_searchname" type="hidden" value="" />
					<input id="f_cc_obligate1" name="f_cc_obligate1" type="hidden" value="" />
					<legend style="text-align: center; margin: 0 auto;">客户账号修改</legend>
					<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="20%" align="right">
										<span class="red">*</span>客户账号:
									</td>
									<td width="30%">
										<input id="f_cc_name_jiami" name="f_cc_name_jiami" style="width: 150px;" value="" class="yl_inp yw_name" />
										<span id="f_cc_name_tip" class="tip"></span>
									</td>
								</tr>
							</table>
						</div>
					</fieldset>
					
					<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="20%" align="right">
										<span class="red">*</span>姓名:
									</td>
									<td width="30%">
										<input id="f_cc_searchname_jiami" name="f_cc_searchname_jiami" style="width: 150px;" value="" class="yl_inp yw_name" />
										<span id="f_cc_searchname_tip" class="tip"></span>
									</td>
								</tr>
							</table>
						</div>
					</fieldset>
					
					<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="20%" align="right">
										<span class="red">*</span>所属行业客户:
									</td>
									<td width="30%">
										<input name="f_cc_companyname" id="f_cc_companyname" readonly="readonly"	style="width: 150px;" value="" class="yl_inp yw_name" />
										<input name="f_cc_companyid" id="f_cc_companyid" type="hidden" value="" />  
										<input name="status" id="status" type="hidden" value="nochange" />  
										<a id="12" class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0);"
											onclick="orgSelect();">选择</a>
									</td>
								</tr>
							</table>
						</div>
					</fieldset>
					
					<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="20%" align="right">
										客户地址
									</td>
									<td width="30%">
										<input id="f_cc_obligate1_jiami" name="f_cc_obligate1_jiami" style="width: 150px;" value="" class="yl_inp yw_name" />
										<span id="f_cc_obligate1_tip" class="tip"></span>
									</td>
								</tr>
							</table>
						</div>
					</fieldset>
					
					
					<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="20%" align="right">
										账号类型:
									</td>
									<td width="30%">
										<select name="f_cc_isfree" id="f_cc_isfree" style="width: 150px;">
										<option value="0">默认</option>
										<limits:uiAuth url="pretrialContent.do">	
										<option value="1">审核</option>
										</limits:uiAuth>
										</select>
									</td>
								</tr>
							</table>
						</div>
					</fieldset>
					
					<!-- 可放入家庭医生的描述信息 -->
					<fieldset>
						<div class="fitem">
							<table width="100%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td width="20%" align="right">
										&nbsp;描述:
									</td>
									<td width="80%">
										<textarea id="f_cc_desc" name="f_cc_desc" style="width: 95%; height: 350px;"></textarea>
										<span id="f_cc_desc_tip" class="tip"></span>
									</td>
								</tr>
							</table>
						</div>
					</fieldset>
					<input id="f_cc_code" type="hidden" name="f_cc_code" type="text" value="0"/>
					
					<input id="f_cc_onlinedate" type="hidden" name="f_cc_onlinedate" type="text" value="2000-01-01 14:22:19" class="yl_inp yw_name" />
					<input id="f_cc_offlinedate" type="hidden" name="f_cc_offlinedate" type="text" value="2100-01-01 14:22:19" class="yl_inp yw_name" />
					<input type="hidden" name="stime" value="<%=nonceObj[0]%>"/>
					<input type="hidden" name="sign" value="<%=nonceObj[1]%>"/>
					<div class="toolbar" style="text-align: center;">
						<a class="easyui-linkbutton" data-options="iconCls:'icon-ok'"
							href="javascript:void(0);" onclick="_submitFm()">保存</a> <a
							href="javascript:void(0);" data-options="iconCls:'icon-cancel'"
							class="easyui-linkbutton"
							onclick="javascript:parent.$('#dlg').dialog('close')">取消</a>
					</div>
				</form>
			</div>
		</div>
		<!--主体 结束-->
		
		
	</div>

	<div id="org_list" class="easyui-dialog"
		style="width: 800px; height: 500px; padding-top: 0px;"
		data-options="title:'客户选择', iconCls:'icon-save',modal:true,closed:true,buttons:'#dlg_buttons'">
		<iframe scrolling="auto" frameborder="0"
			style="width: 100%; height: 99%;"></iframe>
	</div>
</body>
</html>
